﻿@model ContactManagement.Models.EditUserAdminModel
@{
    ViewBag.Title = @Resources.Navigation.EditUserRESX;
}
<h2>@Resources.Navigation.EditUserRESX</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    @Html.ShowCustomMessage()
    <fieldset>
        <legend>@Resources.Navigation.EditUserRESX</legend>
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.UserTitle)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.UserTitle, Model.UserTitles, Resources.GlobalStrings.PleaseSelectItemsRESX)
                @Html.ValidationMessageFor(model => model.UserTitle)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.UserName)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.UserName)
                @Html.ValidationMessageFor(model => model.UserName)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Category)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.Category, Model.Categories, Resources.GlobalStrings.PleaseSelectItemsRESX)
                @Html.ValidationMessageFor(model => model.Category)
            </div>
        </div>
        <div class="clear-all" />
        @* Um was für eine Art von Benutzer es sich handelt, kann nur von einem Admin oder SuperUser festgelegt werden! *@
        @if (CurrentSession.GetCurrentUser().IsAdminOrSuperUser())
        {
            <div class="view-item">
                <div class="editor-label">
                    @Html.LabelFor(model => model.UserType)
                </div>
                <div class="editor-field">
                    @Html.DropDownListFor(model => model.UserType, Model.UserTypes)
                    @Html.ValidationMessageFor(model => model.UserType)
                </div>
            </div>
            <div class="clear-all" />
        }
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.IsActiveUser)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.IsActiveUser)
                @Html.ValidationMessageFor(model => model.IsActiveUser)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Logintries)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Logintries)
                @Html.ValidationMessageFor(model => model.Logintries)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Street)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Street)
                @Html.ValidationMessageFor(model => model.Street)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.ZipCode)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.ZipCode)
                @Html.ValidationMessageFor(model => model.ZipCode)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.City)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.City)
                @Html.ValidationMessageFor(model => model.City)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.HouseNumber)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.HouseNumber)
                @Html.ValidationMessageFor(model => model.HouseNumber)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Firstname)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Firstname)
                @Html.ValidationMessageFor(model => model.Firstname)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Lastname)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Lastname)
                @Html.ValidationMessageFor(model => model.Lastname)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Handy)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Handy)
                @Html.ValidationMessageFor(model => model.Handy)
            </div>
        </div>
        <div class="clear-all" />
        <div class="view-item">
            <div class="editor-label">
                @Html.LabelFor(model => model.Birthdate)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Birthdate)
                @Html.ValidationMessageFor(model => model.Birthdate)
            </div>
        </div>
        <div class="clear-all" />
        <p>
            @Html.DynamicDataType().EditorFor(Model.DynamicData, EFDataModel.Enums.EFModules.Member)
        </p>
        <p>
            <br />
            <input type="submit" value="@Resources.Navigation.SaveChangesRESX" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink(Resources.Navigation.BackToListRESX, EActionUser.UserList.ToString())
    @if(WebRights.Right().Check(EFDataModel.Enums.EUserRights.UserDetails)) { <text>|</text>  @Html.ActionLink(Resources.Navigation.UserDetailsRESX, EActionUser.UserDetails.ToString(), new { id = Model.UserId }) }
    @if(WebRights.Right().Check(EFDataModel.Enums.EUserRights.SetUserRights)) {<text>|</text>  @Html.ActionLink(Resources.Navigation.EditUserRightsRESX, EActionUser.UserEditUserRights.ToString(), new { id = Model.UserId }) }
    @if(WebRights.Right().Check(EFDataModel.Enums.EUserRights.SetUserGroups)) {<text>|</text>  @Html.ActionLink(Resources.Navigation.EditUserGroupsRESX, EActionUser.UserEditUserGroups.ToString(), new { id = Model.UserId }) }
    @if (WebRights.Right().Check(EFDataModel.Enums.EUserRights.SetUserPassword)) { <text>|</text>  @Html.ActionLink(Resources.Navigation.CreateUserPasswordRESX, EActionUser.UserSendNewPassword.ToString(), new { id = Model.UserId })}
</div>
